home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
MODULTUB.LZH
/
PROCED2.MOD
< prev
next >
Wrap
Text File
|
1989-01-18
|
2KB
|
72 lines
(* Chapter 5 - Program 2 *)
MODULE Proced2;
FROM InOut IMPORT WriteString, WriteInt, WriteLn;
VAR Stuff : INTEGER;
Thing : INTEGER;
PROCEDURE PrintDataOut(Puppy : INTEGER);
BEGIN
WriteString("The value of Puppy is ");
WriteInt(Puppy,5);
WriteLn;
Puppy := 12;
END PrintDataOut;
PROCEDURE PrintAndModify(VAR Cat : INTEGER);
BEGIN
WriteString("The value of Cat is ");
WriteInt(Cat,5);
WriteLn;
Cat := 37;
END PrintAndModify;
BEGIN (* Main program *)
FOR Stuff := 3 TO 5 DO
Thing := Stuff;
PrintDataOut(Thing);
WriteString("Back from print, data is ");
WriteInt(Thing,5);
WriteLn;
PrintAndModify(Thing);
WriteString("Back from modify, data is ");
WriteInt(Thing,5);
WriteLn;
PrintDataOut(Thing);
WriteString("Back from print, data is ");
WriteInt(Thing,5);
WriteLn;
WriteLn;
END;
END Proced2.
(* Result of execution
The value of Puppy is 3
Back from print, data is 3
The value of Cat is 3
Back from modify, data is 37
The value of Puppy is 37
Back from print, data is 37
The value of Puppy is 4
Back from print, data is 4
The value of Cat is 4
Back from modify, data is 37
The value of Puppy is 37
Back from print, data is 37
The value of Puppy is 5
Back from print, data is 5
The value of Cat is 5
Back from modify, data is 37
The value of Puppy is 37
Back from print, data is 37
*)